[Security] fix pull_request_target workflow injection (pwn request)#3117
Open
dpfaffenbauer wants to merge 2 commits into
Open
[Security] fix pull_request_target workflow injection (pwn request)#3117dpfaffenbauer wants to merge 2 commits into
dpfaffenbauer wants to merge 2 commits into
Conversation
Switch fork-checkout CI workflows from pull_request_target to pull_request so untrusted fork code no longer runs with secrets and a writable token. Restrict frontend-build (auto-commit, write token) to same-repo branches. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR hardens CoreShop’s GitHub Actions CI against “pwn request” attacks by removing pull_request_target usage from workflows that execute PR code, ensuring fork PRs run with restricted permissions (no secrets, read-only token).
Changes:
- Switch multiple CI workflows from
pull_request_targettopull_requestacross2026.x,5.1, and5.0variants. - Add a same-repo guard to
frontend-build.yamlto avoid running the auto-commit build job on fork PRs. - Keep
cla-check.ymlonpull_request_target(metadata-only), consistent with the PR description.
Reviewed changes
Copilot reviewed 19 out of 19 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| .github/workflows/static.yml | Switch trigger to pull_request to avoid trusted-context execution of fork code. |
| .github/workflows/static-5.1.yml | Same trigger hardening for the 5.1 branch variant. |
| .github/workflows/static-5.0.yml | Same trigger hardening for the 5.0 branch variant. |
| .github/workflows/packages_components.yml | Switch trigger to pull_request for component package CI on 2026.x. |
| .github/workflows/packages_components-5.1.yml | Same trigger hardening for the 5.1 branch variant. |
| .github/workflows/packages_components-5.0.yml | Same trigger hardening for the 5.0 branch variant. |
| .github/workflows/packages_bundles.yml | Switch trigger to pull_request for bundle package CI on 2026.x. |
| .github/workflows/packages_bundles-5.1.yml | Same trigger hardening for the 5.1 branch variant. |
| .github/workflows/packages_bundles-5.0.yml | Same trigger hardening for the 5.0 branch variant. |
| .github/workflows/license-check.yaml | Switch trigger to pull_request to avoid running fork code with secrets. |
| .github/workflows/license-check-5.1.yaml | Same trigger hardening for the 5.1 branch variant. |
| .github/workflows/license-check-5.0.yaml | Same trigger hardening for the 5.0 branch variant. |
| .github/workflows/frontend-build.yaml | Switch to pull_request and add same-repo guard for the auto-commit build job. |
| .github/workflows/behat.yml | Switch trigger to pull_request for Behat CI on 2026.x. |
| .github/workflows/behat-5.1.yml | Same trigger hardening for the 5.1 branch variant. |
| .github/workflows/behat-5.0.yml | Same trigger hardening for the 5.0 branch variant. |
| .github/workflows/behat_ui.yml | Switch trigger to pull_request for UI Behat CI on 2026.x. |
| .github/workflows/behat_ui-5.1.yml | Same trigger hardening for the 5.1 branch variant. |
| .github/workflows/behat_ui-5.0.yml | Same trigger hardening for the 5.0 branch variant. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+14
to
19
| # Only run on same-repo branches. Fork PRs get a read-only token under | ||
| # `pull_request`, so the auto-commit push would fail anyway. | ||
| if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository }} | ||
| permissions: | ||
| contents: write | ||
| uses: ./.github/workflows/shared-frontend-build.yaml |
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Security: fix
pull_request_targetpwn-request vulnerabilityThe CI workflows here trigger on
pull_request_targetwhile checking out the PR head from the fork (ref: …head.sha,repository: …head.repo.full_name). That runs untrusted fork code in the trusted base-repo context — with repository secrets (PIMCORE_PRODUCT_KEY,PIMCORE_INSTANCE_IDENTIFIER,PIMCORE_SECRET) and a writableGITHUB_TOKEN. Classic "pwn request";actions/checkout@v6now hard-blocks it — this is what breaks the Behat job on #3113.Fix
Switch these workflows from
pull_request_targettopull_request, so fork PRs run in the fork's restricted context (no secrets, read-only token). Same code runs, but nothing sensitive to steal and nothing to push.frontend-build.yamladditionally gets anifguard restricting it to same-repo branches — it auto-commits built Studio assets with a writable token, which a fork PR can't do underpull_requestanyway.cla-check.ymlintentionally keepspull_request_target(reads PR metadata only, no fork checkout).Trade-off: fork PRs no longer receive the Pimcore secrets. Same-repo branches/PRs and
pushkeep them. Ifpimcore-installrequires the product key, external fork PRs may fail at install and need a key-less test install path.Covers all affected workflows on
2026.x, including the version-suffixed-5.0/-5.1variants that live only on this branch.🤖 Generated with Claude Code